set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

-- =============================================
-- Author:		Wu,Yue
-- Create date: <Create Date,,>
-- Description:	Build a huge amount of Number
-- =============================================
ALTER FUNCTION [dbo].[Bidding_BuildNumbers]
(	
	@Start BIGINT,
	@End BIGINT
)
RETURNS @Num TABLE
(
	N BIGINT
) 
AS
BEGIN
    WITH a1 AS(SELECT 1 AS m UNION ALL SELECT 1 AS m),
	a2 AS(SELECT 1 AS m FROM a1 AS c1,a1 AS c2),
	a3 AS(SELECT 1 AS m FROM a2 AS c3,a2 AS c4),
	a4 AS(SELECT 1 AS m FROM a3 AS c5,a3 AS c6),
	a5 AS(SELECT 1 AS m FROM a4 AS c7,a4 AS c8),
	a6 AS(SELECT 1 AS m FROM a5 AS c9,a5 AS c10),
	Num AS(SELECT ROW_NUMBER() OVER(ORDER BY m) AS N FROM a6)
	INSERT INTO @Num(N)
	SELECT N FROM Num WHERE N BETWEEN @Start AND @End

	
	
	
   RETURN;
END

